<?php
/**
 * Created by PhpStorm.
 * User: wangsong
 * Time: 2018/5/30 18:08
 */

namespace App\Project\Image;

class ImageDelete
{
    protected $src = [];

    /**
     * ImageDelete constructor.
     * @param $src
     */
    public function __construct($src = [])
    {
        $this->src = $src;
    }

    public function exclude($leave)
    {
        $this->src = array_diff($this->src, $leave);

        return $this;
    }

    public function delete()
    {
        foreach ($this->src as $src) {
            (new Src($src))->path()->delete();
        }
    }

    public function count()
    {
        return count($this->src);
    }
}